package com.myres.db;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;
public class ConnectionPool {
	public static DataSource pool;
	static {
		Context context=null;
		try{
			context=(Context) new InitialContext().lookup("java:comp/env");
			pool=(DataSource)context.lookup("jdbc/DBPool");
			if(pool==null)System.out.print("No Datasoure defined");
		}catch(NamingException e){
			System.out.println("find datasorce exception..........");
			e.printStackTrace();
		}
	}
	public static DataSource getPool(){
		return pool;
	} 
}
